# -*- coding: utf-8 -*-  
from apps.models import Kind, News, User, Comment, Store
from apps.ext import db


class FlaskDbHelper(object):
    def create_db_table(self):
        db.create_all()
        print("create db ok")

    def query_dataset(self, Cls):
        return Cls.query.all()

    def add_record(self, inst):
        try:
            db.session.add(inst)
            db.session.commit()
            return True
        except Exception as e:
            return False


if __name__ == "__main__":
    fh = FlaskDbHelper()
    fh.create_db_table()

